package com.lagou.k8s.controller;

import com.lagou.k8s.pojo.Demo;
import com.lagou.k8s.service.DemoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/demo")
public class DemoController {

    @Resource
    private DemoService demoService;

    @PostMapping
    public void save(@RequestBody Demo demo) {
        demoService.save(demo);
    }

    @PutMapping
    public void update(@RequestBody Demo demo) {
        demoService.update(demo);
    }

    @DeleteMapping
    public void delete(@RequestParam Long id) {
        demoService.delete(id);
    }

    @GetMapping
    public Demo get(@RequestParam Long id) {
        return demoService.get(id);
    }

}
